using System;
using System.Collections.ObjectModel;
using System.Linq;
using System.Collections.Generic;
using System.Windows.Input;
using Microsoft.Practices.Composite.Presentation.Commands;

namespace WizardSample
{
    public class IISSiteData
    {
        /// <summary>
        /// 
        /// </summary>
        public String IISSite
        {
            get; set;
        }

        /// <summary>
        /// 
        /// </summary>
        public Int32 IISSiteId
        {
            get; set;
        }
    }

    /// <summary>
    /// Authentication Wizard Data
    /// </summary>
    public class AuthenticationWizardData : IAuthenticationWizardViewModelController
    {
        private static List<String> transportList =
            new List<string>()
                {
                    "HTTP",
                    "HTTPS",
                    "SSL Relay"
                };

        /// <summary>
        /// 
        /// </summary>
        public static List<String> TransportList
        {
            get { return AuthenticationWizardData.transportList; }
        }

        /// <summary>
        /// 
        /// </summary>
        public AuthenticationWizardData()
        {
        }

        public Boolean AuthenticationServiceMode
        {
            get; set;
        }

        /// <summary>
        /// 
        /// </summary>
        public void AddFarmServer(String server)
        {
            if (null == this.FarmServers
                .FirstOrDefault(s => 0 == String.Compare(s, server)))
            {
                this.FarmServers.Add(server);
            }
        }

        public void EditFarmServer(String oldValue, String newValue)
        {
            if (null != this.FarmServers
                .FirstOrDefault(s => 0 == String.Compare(s, oldValue)))
            {
                Int32 index = this.FarmServers.IndexOf(oldValue);
                this.FarmServers [index] = newValue;
            }
        }

        public void RemoveFarmServer(String server)
        {
            if (null != this.FarmServers
                .FirstOrDefault(s => 0 == String.Compare(s, server)))
            {
                this.FarmServers.Remove(server);
            }
        }

        /// <summary>
        /// Properties
        /// </summary>
        public IList<IISSiteData> IISSiteList
        {
            get; set;
        }

        public Int32 IISSiteItem
        {
            get; set;
        }

        public String AuthServiceVirtualPath
        {
            get; set;
        }

        public String FarmName
        {
            get; set;
        }

        public Int32 FarmPort
        {
            get; set;
        }

        public String FarmTransport
        {
            get; set;
        }

        public ObservableCollection<String> FarmServers
        {
            get; set;
        }

        public int FarmSSLRelayPort
        {
            get; set;
        }

    }
}
